

package com.dmg.controller;

import com.alibaba.fastjson.JSONObject;
import com.dmg.entity.PeiZhi;
import com.dmg.service.BiaoService;
import com.dmg.service.PeiZhiService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
public class BasicController {

    @Autowired
    private BiaoService biaoService;

    @Autowired
    private PeiZhiService peiZhiService;

    //读取biao的数据
    @PostMapping("/aa")
    public String aa() {
        log.info("进入aa-controller");
        biaoService.aa();
        return "ok" ;
    }

    @PostMapping("/bb")
    public String bb() {
        log.info("进入bb-controller");
        List<PeiZhi> list = peiZhiService.getList();
        log.info("读取配置信息：{}", JSONObject.toJSONString(list));
        return "ok" ;
    }

    //添加数据
    @PostMapping("/addBiao")
    public String addBiao() {
        log.info("进入addBiao-controller");
        biaoService.addBiao();
        return "ok" ;
    }
}
